﻿@{
    ViewBag.Title = "页面添加";
    Layout = "~/Views/Shared/_FormLayout.cshtml";
}

<form class="layui-form">
    <div class="layui-form-item">
        <label for="L_email" class="layui-form-label">页面名称</label>
        <div class="layui-input-inline">
            <input type="text" id="pagename" name="pagename" required lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="L_email" class="layui-form-label">页面地址</label>
        <div class="layui-input-inline">
            <input type="text" id="gourl" name="gourl" required lay-verify="required" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="L_pass" class="layui-form-label">备注</label>
        <div class="layui-input-inline">
            <textarea class="layui-textarea" name="content" lay-verify="content" id="content"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-inline">
        <button class="layui-btn" lay-filter="login" lay-submit>保存</button>
        <button class="layui-btn" lay-filter="close" >关闭</button>
        </div>
    </div>
</form>

@section scripts{
    
    <script>
        layui.config({
            base: "~/Content/res/mods/"
        }).use(['layer', 'form'], function () {
            var layer = layui.layer,
                form = layui.form,
                $ = layui.jquery

            form.on('submit(login)', function (data) {
                $.post('@Url.Action("PageAdd")', data.field, function (data) {
                    if (data.code == 0) {
                        layer.alert(data.msg);
                    }
                    else {
                        layer.alert(data.msg);
                    }
                }, 'json')
                return false;
            })
        });
    </script>
    }
